package com.only4play.user.model.entity;

import com.only4play.jpa.support.entity.AggregateEntity;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import lombok.Getter;
import lombok.Setter;

@Entity
@Table(name = "user_role_permission_rel")
@Getter
@Setter
public class UserRolePermissionRel extends AggregateEntity {
    @Id
    private String id;

    @ManyToOne(fetch = FetchType.EAGER, cascade = {CascadeType.MERGE, CascadeType.PERSIST,
        CascadeType.REFRESH})
    @JoinColumn(name = "user_role_id")
    private UserRole role;

    @ManyToOne(fetch = FetchType.EAGER, cascade = {CascadeType.MERGE, CascadeType.PERSIST,
        CascadeType.REFRESH})
    @JoinColumn(name = "user_permission_id")
    private UserPermission permission;
}
